package cc.lj.internal.coupons.application.service;

import cc.lj.internal.coupons.domain.ticket.model.vo.TicketMainDO;
import cc.lj.internal.coupons.domain.ticket.service.ITicketMainDomainService;
import cc.lj.internal.coupons.interfaces.dto.TicketMainDTO;
import cc.lj.internal.coupons.interfaces.dto.convert.TicketMainDTOConvertDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * 电子券主表ticket_main app service
 * @author liangxifeng
 * @date 2023/10/11 14:45
 */
@Service
@Slf4j
public class TicketMainAppService {
    //电子券领域service
    @Resource(name = "ticketMainDomainServiceImpl")
    private ITicketMainDomainService mainDomainService;

    /**
     * 通过主键批量查询电子券表数据
     * @param idList 主键List
     * @return List<电子券表实体>
     */
    public List<TicketMainDO> getByIds (List<Integer> idList) {
        return mainDomainService.getByIds(idList);
    }

    /**
     * 通过主键批量修改 ticket_main 表
     * @param idList 主键List [1,2,3]
     * @param ticketMainDTO 修改实体
     * @return 影响行数
     */
    public Integer updateByIds(List<Integer> idList, TicketMainDTO ticketMainDTO) {
        return mainDomainService.updateByIds(idList, TicketMainDTOConvertDO.INSTANCE.convert(ticketMainDTO));
    }
}
